#!/usr/bin/python
# -*- coding: UTF-8 -*-

import numpy as np
import pandas as pd
from sklearn.externals import joblib
import matplotlib.pyplot as plt

path='../datas/household_power_consumption_201.txt'
data = pd.read_csv(filepath_or_buffer=path, sep=';')
data.replace('?',np.nan,inplace=True)
data = data.dropna(axis=0, how='any')

x = data.iloc[:, 2:4]
y = data.iloc[:, 5]

algo = joblib.load('./linear')

y_hat = algo.predict(x)
plt.figure()
t = np.arange(len(y))
plt.plot(t,y,'r-')
plt.plot(t,y_hat,'b-')
plt.legend()
plt.show()


if __name__ == '__main__':
    pass